# 3: "QUAD4",
# 2: "CTRIA3",
# 15: "POINT1",
# 4: "CTETRA",
# 5: "CHEXA",
# 6: "CPENTA",
# 1: "CBAR",


def cell_type_to_cn(cell_type):
    match cell_type:
        case "CBAR":
            return "线型结构"
        case "QUAD4":
            return "四边形"
        case "CTRIA3":
            return "三角形"
        case "POINT1":
            return "点"
        case "CTETRA":
            return "四面体"
        case "CHEXA":
            return "六面体"
        case "CPENTA":
            return "棱柱"
    return "未知"


def get_cell_type_key_type(cell_type):
    match cell_type:
        case "CBAR":
            return "line"
        case "QUAD4":
            return "d2"
        case "CTRIA3":
            return "d2"
        case "CTETRA":
            return "d3"
        case "CHEXA":
            return "d3"
        case "CPENTA":
            return "d3"
    return "未知"


def get_cell_type_by_point_count(point_count, name=""):
    match point_count:
        case 2:
            return "CBAR"
        case 4:
            if name.upper().find("TETRA") == -1:
                return "QUAD4"
            else:
                return "CTETRA"
        case 3:
            return "CTRIA3"
        case 8:
            return "CHEXA"
        case 6:
            return "CPENTA"
    return None
